package com.bonc.event.controller.api;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.bonc.event.model.BONCEvent;
import com.bonc.event.service.IEventRecognitionService;
//import com.bonc.text.entity.recognition.RecResult;

/**
 * @author donggui@bonc.com.cn
 * @version 2016 2016年6月28日 上午10:07:04
 */
@Controller
@RequestMapping(value = "/api/event/recognition")
public class EventController {

	@Autowired
	IEventRecognitionService eventRecognitionService;
	
	@RequestMapping(value = "/all", method = RequestMethod.POST, produces="text/html;charset=UTF-8")
	@ResponseBody
	public String entityRecognition(@RequestParam(value="content") String content,HttpServletRequest request, HttpServletResponse resp){
		Map<String, Object> map = new HashMap<String, Object>();
		List<BONCEvent> ploTexts = eventRecognitionService.getEventList(content);
		map.put("status", "200");
		map.put("msg", "实体提取成功");
		map.put("data", ploTexts);
		
		return JSON.toJSONString(map);
		
	}

}
